<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>003原生_max_min_去重</title>
</head>
<body>
    <script>
        let arr = [1,2,2,3,3,4,4,5,5]
        // max, min
        let max = arr[0]
        let min = arr[0]
        for(let i = 1; i < arr.length; i++) {
            if(max < arr[i]) {
                max = arr[i]
            }
            if(min > arr[i]) {
                min = arr[i]
            }
        }
        console.log('max', max)
        console.log('min', min)

        // 去重
        let setArr = new Set(arr)
        let newArr = []
        for(let v of setArr) {
            newArr.push(v)
        }
        console.log('setArr', setArr)
        console.log('newArr', newArr)
    </script>
</body>
</html>